package com.houdoudou.servlet.app;

import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.Date;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.houdoudou.affair.app.SupplierAffairApp1;
import com.houdoudou.affair.app.SupplierAffairApp2;
import com.houdoudou.affair.jsp.ProgrammerAffairJsp1;

public class Supplier4App  extends HttpServlet{

	private static final long serialVersionUID = 3L;

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		// TODO Auto-generated method stub
		process(req, resp);
	}

	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		// TODO Auto-generated method stub
		process(req, resp);
	}
	

	void process(HttpServletRequest req, HttpServletResponse resp) throws IOException{
		
		String affair="";
		    try {
				req.setCharacterEncoding("UTF-8");
				  resp.setCharacterEncoding("UTF-8");
					 affair=req.getParameter("affair");
					 System.out.println("/n");
					 System.out.println("affair="+affair + "  时间----"+ new Date());
					 System.out.println("/n");
		    } catch (UnsupportedEncodingException e) {
		    	
		    }		    
		    //登陆
			 if(affair.equals("login")){ 
				  SupplierAffairApp1.login(req, resp);
			 }//新增目录
			 if(affair.equals("createIndex")){ 
				  SupplierAffairApp1.createIndex(req, resp);
			 }//搜索目录
			 if(affair.equals("searchIndex")){ 
				  SupplierAffairApp1.searchIndex(req, resp);
			 }//删除目录
			 if(affair.equals("deleteIndex")){ 
				  SupplierAffairApp1.deleteIndex(req, resp);
			 }//更新目录
			 if(affair.equals("updateIndex")){ 
				  SupplierAffairApp1.updateIndex(req, resp);
			 }//创建产品
			 if(affair.equals("createProduct")){ 
				  SupplierAffairApp1.createProduct(req, resp);
			 }//搜索产品
			 if(affair.equals("searchProduct")){ 
				  SupplierAffairApp1.searchProduct(req, resp);
			 }//删除产品
			 if(affair.equals("deleteProduct")){ 
				  SupplierAffairApp1.deleteProduct(req, resp);
			 }//更新产品
			 if(affair.equals("updateProduct")){ 
				  SupplierAffairApp1.updateProduct(req, resp);
			 }//搜索订单
			 if(affair.equals("searchOrder")){ 
				  SupplierAffairApp1.searchOrder(req, resp);
			 }//搜索分配
			 if(affair.equals("searchDistribute")){ 
				  SupplierAffairApp1.searchDistribute(req, resp);
			 }//接单
			 if(affair.equals("acceptOrder")){ 
				  SupplierAffairApp1.changeOrderState(req, resp);
			 }//据单
			 if(affair.equals("refuseOrder")){ 
				  SupplierAffairApp1.refuseOrder(req, resp);
			 }//打印
			 if(affair.equals("printOrder")){ 
				  SupplierAffairApp1.printOrder(req, resp);
			 }//发货
			 if(affair.equals("shipOrder")){ 
				  SupplierAffairApp1.changeOrderState(req, resp);
			 }//搜索退款
			 if(affair.equals("searchRefund")){ 
				  SupplierAffairApp1.searchRefund(req, resp);
			 }//
			 if(affair.equals("refuseRefund")){ 
				  SupplierAffairApp1.refuseRefund(req, resp);
			 } //
			 if(affair.equals("agreeRefund")){ 
				  SupplierAffairApp1.agreeRefund(req, resp);
			 }//
			 if(affair.equals("createCourier")){ 
				  SupplierAffairApp2.createCourier(req, resp);
			 }
	}
}
